1. Field of the Invention
The present invention relates to the JAVA® programming language and particularly, a system and method of implementing adapters and dynamic proxies to provide various dynamic implementations of interfaces.
2. Discussion of the Prior Art
In the JAVA® programming language (JAVA is a registered trademark of Sun Microsystems, Inc., located in Mountain View, Calif.) implementations of an interface must implement all methods defined in that interface. This is to guarantee a common interface between different object types. However, in some circumstances, implementations of various methods on a given interface are repetitive and could be implemented using a default behavior, while other methods may require specific implementations. In JAVA®, this is not easily accomplished. To have specific implementations of only a particular set of methods in an interface, there is an adapter pattern, which provides empty implementations of all methods, and subclasses implement only the methods that they need. However, this does not provide an easy default implementation of the other methods. To have a default implementation of all methods, there is also a dynamic proxy, which provides an easy way to have a default implementation of all methods in an interface. However, in this case, it is difficult to have specific implementations for particular methods since the default implementation is done in one method.
It would be highly desirable to provide an interface, which has some methods that can be implemented the same way, and other methods that must be handled specially.